29. Exercise: Vector Drawables

L1 64 Vector Drawables SC

Now it’s your turn to complete this exercise.

1. Enable the use of support library for vector drawables in build.gradle file (app level):

vectorDrawables.useSupportLibrary = true

2. Use app:srcCompat in the image tag in the layout file:

app:srcCompat="@drawable/empty_dice"

3. You’ll also need to add the namespace to the root of the layout:

xmlns:app="http://schemas.android.com/apk/res-auto"

If you want to start at this step, you can download this exercise code here: Step.06-Exercise-Use-Vector-Drawable-Compat.

You will find plenty of //TODO comments to help you complete this exercise, and if you get stuck, go back and watch the video again.

Once you’re done, you can check your solution against the solution we’ve provided here Step.06-Solution-Use-Vector-Drawable-Compat or using this git diff.

Task Description:

Check the steps below as you implement them to complete this exercise.

Task List:

Task Feedback:

Woo hoo! You've completed your first app!

Solution: Step.06-Solution-Use-Vector-Drawable-Compat or using this git diff.